//
//  MoreThanDetailViewController.m
//  嘀嘀拍
//
//  Created by 陈一航 on 16/3/2.
//  Copyright © 2016年 wangjia_01. All rights reserved.
//

#import "MoreThanDetailViewController.h"
#import "CommonCell.h"
#import "CommonCell2.h"
#import "PictureLookViewController.h"
#import "CustomButton.h"
#import "TWEmojiKeyBoard.h"
#import "Biaoqing.h"
#import "CustomImgView.h"
#define faceWH 30
static NSString *staticCell=@"CommonCell2";



@interface MoreThanDetailViewController ()<UITableViewDataSource,UITableViewDelegate
,UITextViewDelegate,UIGestureRecognizerDelegate,UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout,UIScrollViewDelegate
>

{
    NSInteger selectSection;
    UIPageControl *pageControlBottom;
    UICollectionView *_scrollView;
    BOOL isEmojiKeyBoard;
    
    UIView *bgView;
    //TWEmojiKeyBoard *keyBoard;//注意！！！这里必须用全局变量


}
@property (weak, nonatomic) IBOutlet UITableView *mListview;
@property (nonatomic,strong)NSMutableDictionary *emojeDic;
@property (nonatomic,strong)NSMutableArray *emojeKeyArray;
@property (nonatomic,strong)NSMutableArray *emojeValueArray;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *mListViewHC;
@property (nonatomic,strong)NSMutableArray *imageArray;
@property (nonatomic,strong)NSMutableArray *answerArray;
@property (nonatomic,strong)NSString *videoUrl;
@property (nonatomic,strong)NSIndexPath *selectIndexPath;


@property (weak, nonatomic) IBOutlet UIImageView *userPhoto;
@property (weak, nonatomic) IBOutlet UILabel *userName;
@property (weak, nonatomic) IBOutlet UILabel *userLocation;
@property (weak, nonatomic) IBOutlet UIButton *tanMu;
@property (weak, nonatomic) IBOutlet UIView *palyLayer;
@property (weak, nonatomic) IBOutlet UILabel *playDesc;
@property (weak, nonatomic) IBOutlet UILabel *label1;
@property (weak, nonatomic) IBOutlet UILabel *label2;
@property (weak, nonatomic) IBOutlet UILabel *label3;
@property (weak, nonatomic) IBOutlet UILabel *label4;
@property (weak, nonatomic) IBOutlet UIButton *dianZan;
@property (weak, nonatomic) IBOutlet UIButton *collection;
@property (weak, nonatomic) IBOutlet UIButton *isGuanzhuBtn;
@property (weak, nonatomic) IBOutlet UILabel *isGuanzhuLab;

@property (weak, nonatomic) IBOutlet UITextView *repayTV;
@property (nonatomic,strong)NSString *userID;
@property (weak, nonatomic) IBOutlet UIView *footerView;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *footerViewHC;

@end

@implementation MoreThanDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    _mListview.delegate=self;
    _mListview.dataSource=self;
    // isEmojiKeyBoard=NO;
    _imageArray=@[].mutableCopy;
    _answerArray=@[].mutableCopy;
    [_mListview registerNib:[UINib nibWithNibName:@"CommonCell2" bundle:nil] forCellReuseIdentifier:staticCell];
    [isLogin FilletImg:self.userPhoto :80];
    
    _emojeKeyArray=@[].mutableCopy;
    _emojeValueArray=@[].mutableCopy;
    
    [self headData];
    [self commonData];
    [self loadEmojiArray];
    // Do any additional setup after loading the view from its nib.
}

#pragma mark -custom facelib

- (void)loadEmojiArray
{
        int emojiRangeArray[10] = {0xE001,0xE05A,0xE101,0xE15A,0xE201,0xE253,0xE401,0xE44C,0xE501,0xE537};
        for (int j = 0 ; j<10 ; j+=2 ) {
    
            int startIndex = emojiRangeArray[j];
            int endIndex = emojiRangeArray[j+1];
    
            for (int i = startIndex ; i<= endIndex ; i++ ) {
                //添加到数据源数组
                [self.emojeKeyArray addObject:[NSString stringWithFormat:@"%C", (unichar)i]];
            }
        }
    
    
    //创建数据源
//    
//    NSString *path=[[NSBundle mainBundle] pathForResource:@"Expression" ofType:@"plist"];
//    
//    _emojeDic=[[NSMutableDictionary alloc]  initWithContentsOfFile:path];
//    
//
//    
//    for(int i=0;i<_emojeDic.allKeys.count;i++)
//    {
//        [_emojeKeyArray addObject:_emojeDic.allKeys[i]];
//        
//    }
//    
//    for(int i=0;i<_emojeDic.allValues.count;i++)
//    {
//        
//        [_emojeValueArray addObject:_emojeDic.allValues[i]];
//    }
    
    isEmojiKeyBoard=NO;
    
    //为了摆放分页控制器，创建一个背景view
    bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 200)];
    //分页控制器
   // [self.repayTV.inputView addSubview:bgView];
    pageControlBottom = [[UIPageControl alloc]initWithFrame:CGRectMake(0,170, [UIScreen mainScreen].bounds.size.width, 20)];
    [pageControlBottom setTintColor:[UIColor redColor]];
    [_footerView addSubview:pageControlBottom];
    //collectionView布局
    UICollectionViewFlowLayout * layout = [[UICollectionViewFlowLayout alloc]init];
    //水平布局
    layout.scrollDirection=UICollectionViewScrollDirectionHorizontal;
    //设置每个表情按钮的大小为30*30
    layout.itemSize=CGSizeMake(30, 30);
    //计算每个分区的左右边距
    float xOffset = (__MainScreen_Width-7*30-10*6)/2;
    //设置分区的内容偏移
    layout.sectionInset=UIEdgeInsetsMake(10, xOffset, 10, xOffset);
    _scrollView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 160) collectionViewLayout:layout];
    //打开分页效果
    _scrollView.pagingEnabled = YES;
    //设置行列间距
    layout.minimumLineSpacing=10;
    layout.minimumInteritemSpacing=5;
     [_scrollView registerNib:[UINib nibWithNibName:@"Biaoqing" bundle:nil] forCellWithReuseIdentifier:@"biaoqing"];
    _scrollView.delegate=self;
    _scrollView.dataSource=self;
    _scrollView.backgroundColor = bgView.backgroundColor;
    [bgView addSubview:_scrollView];
   
}

//每页28个表情
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    if (((_emojeKeyArray.count/28)+(_emojeKeyArray.count%28==0?0:1))!=section+1) {
        return 28;
    }else{
        return _emojeKeyArray.count-28*((_emojeKeyArray.count/28)+(_emojeKeyArray.count%28==0?0:1)-1);
    }
    
}
//返回页数
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
    return (self.emojeKeyArray.count/28)+(self.emojeKeyArray.count%28==0?0:1);
}

-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    
    /*
    Biaoqing * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"biaoqing" forIndexPath:indexPath];
    
    for (int i=cell.contentView.subviews.count; i>0; i--) {
        [cell.contentView.subviews[i-1] removeFromSuperview];
    }
    
    CustomImgView *customIMG=[[CustomImgView alloc]initWithFrame:CGRectMake(0, 0,faceWH,faceWH)];
    
    
    customIMG.image=[UIImage imageNamed:[NSString stringWithFormat:@"%@.png",[NSString stringWithFormat:@"%@",_emojeValueArray[indexPath.row+indexPath.section*28]]]];
    
    [cell.contentView addSubview:customIMG];
    //    UILabel * label = [[UILabel alloc]initW
     ithFrame:CGRectMake(0, 0, 30, 30)];
    //    label.font = [UIFont systemFontOfSize:25];
    //    label.text =self.ExpertArray[indexPath.row+indexPath.section*28] ;
    //
    //
    //    [cell.contentView addSubview:label];
     */
    
    static NSString *staticCell=@"biaoqing";
    
    Biaoqing * cell =[collectionView dequeueReusableCellWithReuseIdentifier:staticCell forIndexPath:indexPath ];
    
    for (int i=cell.contentView.subviews.count; i>0; i--) {
        [cell.contentView.subviews[i-1] removeFromSuperview];
    }
    
    UILabel * label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 30, 30)];
    label.font = [UIFont systemFontOfSize:25];
    label.text =_emojeKeyArray[indexPath.row+indexPath.section*28] ;
    
    
    [cell.contentView addSubview:label];
    return cell;
    
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
    
    NSString * str = self.emojeKeyArray[indexPath.section*28+indexPath.row];
    
    [_repayTV setText:[NSString stringWithFormat:@"%@%@",_repayTV.text,str]];
    //这里手动将表情符号添加到textField上
    
}

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
    return CGSizeMake(30, 30);
}

//翻页后对分页控制器进行更新
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
    
    if(scrollView==_scrollView)
    {
        CGFloat contenOffset = scrollView.contentOffset.x;
        int page = contenOffset/scrollView.frame.size.width+((int)contenOffset%(int)scrollView.frame.size.width==0?0:1);
        pageControlBottom.currentPage = page;
        
    }
}





- (void)textViewDidBeginEditing:(UITextView *)textView
{
    
    if ([textView.text hasPrefix:@"评论"]) {
        [textView setText:@""];
      
    }
    
    if (self.footerViewHC.constant>64) {
        self.footerViewHC.constant=64;
    }
    

}

#pragma mark --得到头部数据
- (void)headData
{
    WC;
    [httpRequest getVideoInfoBy:self.questionID Complement:^(NSDictionary *dic) {
        
        DLog(@"%@",dic);
        DLog(@"%@",dic[@"message"]);
        
        if ([dic[@"code"] integerValue]==200) {
            [isLogin setVendorImageUrl:weakSelf.userPhoto :[isLogin isNull:dic[@"data"][@"publish_user_avatar"]]];
            // "user_follow" = 1;
            
            if ([dic[@"data"][@"user_follow"] integerValue]==1) {
                weakSelf.isGuanzhuLab.text=@"已关注 TA";
            }else
            {
                weakSelf.isGuanzhuLab.text=@"关注TA";
            }
            
            
            if ([dic[@"data"][@"has_thanks"] integerValue]==1) {
                weakSelf.dianZan.selected=YES;
            }else
            {
                weakSelf.dianZan.selected=NO;
            }
            
            
            
            if ([dic[@"data"][@"has_attach"] integerValue]==1) {
                weakSelf.collection.selected=YES;
            }else
            {
                weakSelf.collection.selected=NO;
            }
            
            weakSelf.userID=[isLogin isNull:dic[@"data"][@"published_uid"]];
            weakSelf.label1.text=[isLogin isNull:dic[@"data"][@"thanks_count"]];
            weakSelf.label2.text=[isLogin isNull:dic[@"data"][@"answer_count"]];
            weakSelf.label3.text=[isLogin isNull:dic[@"data"][@"collection_count"]];
            weakSelf.label4.text=[isLogin isNull:dic[@"data"][@"view_count"]];
            
            weakSelf.userName.text=[isLogin isNull:dic[@"data"][@"publish_user_name"]];
            weakSelf.userLocation.text=[isLogin isNull:dic[@"data"][@"question_addr"]];
            weakSelf.playDesc.text=[isLogin isNull:dic[@"data"][@"question_content"]];
            
            NSArray *array=dic[@"data"][@"attachs"];
            if (![array isEqual:[NSNull null]]) {
                if (array.count>0) {
                    
                    for ( int i=0; i<array.count; i++) {
                        [weakSelf.imageArray addObject:array[i]];
                    }
                    if (weakSelf.imageArray.count>0) {
                        //添加可点击的URL
                        
                       
                        
                        UIImageView *imageBg=(UIImageView *)[self.palyLayer viewWithTag:5000];
                        if (!imageBg) {
                            imageBg=[[UIImageView alloc] init];
                            imageBg.frame=CGRectMake(0, 0, self.palyLayer.bounds.size.width, self.palyLayer.bounds.size.height);
                            [isLogin setVendorImageUrl:imageBg :weakSelf.imageArray[0][@"attachment"]];
                            imageBg.userInteractionEnabled=YES;
                            [self.palyLayer addSubview:imageBg];
                            
                            UITapGestureRecognizer *tapGesture=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickCheckOut:)];
                            
                            [imageBg addGestureRecognizer:tapGesture];
                            
                        }
                        
                    }
                }
            }
            

        }
    } ];

}

- (void)clickCheckOut:(UITapGestureRecognizer *)tapGuesture
{
    
    if (self.imageArray.count>0) {
        NSMutableArray *array=[NSMutableArray array];
        for ( int i=0; i<self.imageArray.count; i++) {
            [array addObject:self.imageArray[i][@"attachment"]];
        }
        
        PictureLookViewController *pictureLookVC=[PictureLookViewController new];
        pictureLookVC.page=0;
        pictureLookVC.dataArray=array;
        
        [self.navigationController pushViewController:pictureLookVC animated:YES];
    }

   
}

#pragma mark --得到评论列表数据

- (void)commonData
{   WC;
    [httpRequest  getPostInfoBy:self.questionID :nil Complement:^(NSDictionary *dic) {
        DLog(@"%@",dic);
        
        if ([dic[@"code"] integerValue]==200) {
            
            
            if (weakSelf.answerArray.count>0) {
                [weakSelf.answerArray removeAllObjects];
                weakSelf.mListViewHC.constant=0;
                
            }
            
            NSArray *array=dic[@"data"];
            if (![array isEqual:[NSNull null]]) {
                if (array.count>0) {
                    
                    for ( int i=0; i<array.count; i++) {
                        
                        [weakSelf.answerArray addObject:array[i]];
                        
                        
                    }
                    CGFloat height=0;
                    
                    for ( int i=0; i<weakSelf.answerArray.count; i++) {
                        
                        height+=[isLogin GetFontHeight:weakSelf.answerArray[i][@"answer_content"] font:[UIFont systemFontOfSize:16] width:__MainScreen_Width-77]+71; //这块的高度 需要进行字体计算
                        
                        NSArray *array=weakSelf.answerArray[i][@"second_live"];
                        if (![array isEqual:[NSNull null]]) {
                            if (array.count>0) {
                                
                                for ( int i=0; i<array.count; i++) {
                                    
                                    height+=[isLogin GetFontHeight:array[i][@"answer_content"] font:[UIFont systemFontOfSize:16] width:__MainScreen_Width-132]+51;  //这块的高度 需要进行字体计算
                                    
                                }
                                
                            }
                        }
                        
                    }
                    weakSelf.mListViewHC.constant=height;
                    [weakSelf.mListview reloadData];
                }
            }
        }
    }];

}


#pragma mark -UITableViewDelegate/Datasource

//大评论
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

{
    
    return self.answerArray.count>0?self.answerArray.count:0;

}
//小评论
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    NSArray *array=self.answerArray[section][@"second_live"];
    return  array.count>0?array.count:0;
    
}


- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    
   CommonCell  *cell=[[[NSBundle mainBundle] loadNibNamed:@"CommonCell" owner:nil options:nil] lastObject];
    [isLogin setVendorImageUrl:cell.userPhoto :[isLogin isHttpHeader:[isLogin isNull:self.answerArray[section][@"user_info"][@"avatar"]]]];
    
    cell.userName.text=[isLogin isNull:self.answerArray[section][@"user_info"][@"user_name"]];
    cell.repayButton.tag=section;
    [cell.repayButton addTarget:self action:@selector(repayPerson:) forControlEvents:UIControlEventTouchUpInside];
    [cell setQzContentLable:self.answerArray[section][@"answer_content"]];
    
    return cell;
    
}

//这是给首页回复
- (void)repayPerson:(CustomButton *)button
{
    selectSection=0;
    _selectIndexPath=[NSIndexPath indexPathWithIndex:button.selected];
    [_repayTV setText:[NSString stringWithFormat:@"评论%@",[isLogin isNull:self.answerArray[button.tag][@"user_info"][@"user_name"]]]];
    selectSection=button.tag+1;
    
}

//这是给子回复回复 暂且不写
- (void)repaySubPerson:(CustomButton *)button
{
    
}


- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{

    return [isLogin GetFontHeight:self.answerArray[section][@"answer_content"] font:[UIFont systemFontOfSize:16] width:__MainScreen_Width-77]+71;
    
}




- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    CommonCell2 *cell=[tableView dequeueReusableCellWithIdentifier:staticCell];
    cell.selectionStyle=UITableViewCellSelectionStyleNone;
    
    NSArray *array=self.answerArray[indexPath.section][@"second_live"];
    
    
    [isLogin setVendorImageUrl:cell.userPhoto :[isLogin isHttpHeader:[isLogin isNull:array[indexPath.row][@"user_info"][@"avatar"]]]];
    
    
    cell.userName.text=[isLogin isNull:array[indexPath.row][@"user_info"][@"user_name"]];
  
    
    [cell setQzContentLable:[isLogin isNull:array[indexPath.row][@"answer_content"]]];
    
    return cell;

}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    //单元格计算高度82-18 +字体高度  宽度  320- 76
    
    NSArray *array=self.answerArray[indexPath.section][@"second_live"];
    if (![array isEqual:[NSNull null]]) {
        if (array.count>0) {
            
       
            return    [isLogin GetFontHeight:array[indexPath.row][@"answer_content"] font:[UIFont systemFontOfSize:16] width:__MainScreen_Width-132]+51;  //这块的高度 需要进行字体计算
                
            
    
        }else
        {
            return 0;
        }
    }else
    {
        return 0;
    }

}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
- (IBAction)dianZAN:(id)sender {
    WC;
    [httpRequest dianZanISSuccess:self.questionID Complement:^(NSDictionary *dic) {
        DLog(@"%@",dic);
        if ([dic[@"code"] integerValue]==200) {
            
            [weakSelf  getDianZanNum];
            
        }else
        {
            [SVProgressHUD showErrorWithStatus:dic[@"message"]];
        }
        
    }];
    
}
- (IBAction)collection:(id)sender {
    WC;
    [httpRequest collectionTheVideoBy:self.questionID Complement:^(NSDictionary *dic) {
        
         DLog(@"%@",dic[@"message"]);
        if ([dic[@"code"] integerValue]==200) {
            
            [weakSelf  getCollectionStatus];
            
        }else
        {
            [SVProgressHUD showErrorWithStatus:dic[@"message"]];
        }
        
    }];
    
}
- (IBAction)clickGuanZhu:(id)sender {
        WC;
        [httpRequest guanZhuISSuccess:self.userID Complement:^(NSDictionary *dic) {
           
            if ([dic[@"code"] integerValue]==200) {
                [weakSelf getGuanZhuStatus];
            }else
            {
                [SVProgressHUD showErrorWithStatus:dic[@"message"]];
            }
            
        }];
}

- (IBAction)openFaceLib:(id)sender {
    /*
     if(!isEmojiKeyBoard) {
        
        /
         使用自定义键盘
         /
        isEmojiKeyBoard=YES;
        
        if (!keyBoard) {
            
            keyBoard=[[TWEmojiKeyBoard alloc]init];
            
            [keyBoard createEmojiKeyBoard];
            
        }
        
        [sender setImage:[UIImage imageNamed:@"btn_publish_keyboard_b"] forState:0];
        [keyBoard bindKeyBoardWithTextField:_repayTV];
        
        
    }else{
        
        
        /
           使用系统默认的键盘
         /
        [keyBoard unbindKeyBoard];
        [sender setImage:[UIImage imageNamed:@"btn_publish_face_b"] forState:0];
        isEmojiKeyBoard=NO;
        
        
    }
    
   
    
*/
   
     [_repayTV becomeFirstResponder];
   
    if (![_repayTV isFirstResponder]) {
        return;
    }
    if (isEmojiKeyBoard==NO) {
        isEmojiKeyBoard=YES;
        //呼出表情
        _repayTV.inputView=bgView;
        [_repayTV reloadInputViews];
    }else{
        isEmojiKeyBoard=NO;
        _repayTV.inputView=nil;
        [_repayTV reloadInputViews];
    }
    
}
- (IBAction)sendMessage:(id)sender {
    DLog(@"%@",_repayTV.text);
    
    DLog(@"%@",_repayTV.attributedText);

    
    if (!selectSection>0) {
        [httpRequest sendMessageInfoBy:self.questionID :_repayTV.text Complement:^(NSDictionary *dic) {
            if ([dic[@"code"] integerValue]==200) {
                _repayTV.text=@"";
                self.editing=NO;
                _footerViewHC.constant=64;
                
                [self commonData];
                [self getCommonNum];
            }else
            {
                DLog(@"%@",dic[@"message"]);
            
            }
        
        }];
        
    }else
    {
        [httpRequest sendSecondMessageInfoBy:self.answerArray[selectSection-1][@"answer_id"] :_repayTV.text Complement:^(NSDictionary *dic) {
            if ([dic[@"code"] integerValue]==200) {
                _repayTV.text=@"";
                self.editing=NO;
                _footerViewHC.constant=64;

                [self commonData];
                [self getCommonNum];
            }else
            {
                DLog(@"%@",dic[@"message"]);
                
            }

        }];
    }
    
    selectSection=0;
   
}

- (void)getDianZanNum
{   WC;
    [httpRequest getVideoInfoBy:self.questionID Complement:^(NSDictionary *dic) {
        DLog(@"%@",dic);
        if ([dic[@"code"] integerValue]==200) {
            
            if ([dic[@"data"][@"has_thanks"] integerValue]==1) {
                weakSelf.dianZan.selected=YES;
            }else
            {
                weakSelf.dianZan.selected=NO;
            }
             weakSelf.label1.text=[isLogin isNull:dic[@"data"][@"thanks_count"]];
            
        }else
        {
            [SVProgressHUD showErrorWithStatus:dic[@"message"]];
        }
    
    }];
    
}

- (void)getCommonNum
{       WC;
    [httpRequest getVideoInfoBy:self.questionID Complement:^(NSDictionary *dic) {
        DLog(@"%@",dic);
        if ([dic[@"code"] integerValue]==200) {
            
            weakSelf.label2.text=[isLogin isNull:dic[@"data"][@"answer_count"]];
            
        }else
        {
            [SVProgressHUD showErrorWithStatus:dic[@"message"]];
        }
        
    }];
    
}

- (void)getGuanZhuStatus
{   WC;
    
    [httpRequest getVideoInfoBy:self.questionID Complement:^(NSDictionary *dic) {
        DLog(@"%@",dic);
        if ([dic[@"code"] integerValue]==200) {
            
            if ([dic[@"data"][@"user_follow"] integerValue]==1) {
                weakSelf.isGuanzhuLab.text=@"已关注 TA";
            }else
            {
                weakSelf.isGuanzhuLab.text=@"关注TA";
            }

            
        }else
        {
            [SVProgressHUD showErrorWithStatus:dic[@"message"]];
        }
       
    }];
}

- (void)getCollectionStatus
{
    WC;
    [httpRequest getVideoInfoBy:self.questionID Complement:^(NSDictionary *dic) {
        DLog(@"%@",dic);
        
        if ([dic[@"code"] integerValue]==200) {
            
            if ([dic[@"data"][@"has_attach"] integerValue]==1) {
                weakSelf.collection.selected=YES;
            }else
            {
                weakSelf.collection.selected=NO;
            }
            
            weakSelf.label3.text=[isLogin isNull:dic[@"data"][@"collection_count"]];
            
            
        }else
        {
            [SVProgressHUD showErrorWithStatus:dic[@"message"]];
        }
    }];
}




@end
